{% extends "base.html" %}
{% load i18n %}
{% block title %} Tu Negocio Empresarios - Ver Inventario{% endblock %}

{% block head-css-ext %}
    <link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}css/layout.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}css/blue/style.css" media="print, projection, screen" />
{% endblock %}

{% block head-js-ext %}
    <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.js"></script>
    <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.tablesorter.js"></script>
    <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.tablePagination.js"></script>
    <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.translate.js"></script>
{% endblock %}

{% block head-js-embedded %}
    <script type="text/javascript">
        $(document).ready(function(){
            var options = {
                firstArrow : (new Image()).src="{{MEDIA_URL}}img/icons/first.png",
                prevArrow : (new Image()).src="{{MEDIA_URL}}img/icons/prev.png",
                lastArrow : (new Image()).src="{{MEDIA_URL}}img/icons/last.png",
                nextArrow : (new Image()).src="{{MEDIA_URL}}img/icons/next.png"
            }
            $("#inventario")
                .tablesorter({widthFixed: true,  widgets: ['zebra'] })
                .tablePagination(options);
		
            $("#tablePagination").translate('en', 'es');

        });        
    </script>
{% endblock %}
    {% block content-box1 %}
        <b>Inventario actcual de: {{ usuario.first_name }} {{ usuario.last_name }}</b>
        <br><br>
        {% if inventario %}
            <table id="inventario" class="tablesorter">
                <thead>
                    <tr align="center">
                        <th>Producto</th>
                        <th>Existencias</th>
                        <th>Valor</th>                   
                    </tr>            
                </thead>
                <tbody>
                    {% for producto in inventario %}
                        {% ifequal producto.existencias 0 %}
                            <tr align="center">
                                <td style="color:#FF0000;">{{ producto.producto }}</td>
                                <td style="color:#FF0000;">{{ producto.existencias }}</td>
                                <td style="color:#FF0000;">{{ producto.valor }}
                            </tr>
                        {% else %}
                            <tr align="center">
                                <td style="color:#088A08;">{{ producto.producto }}</td>
                                <td style="color:#088A08;">{{ producto.existencias }}</td>
                                <td style="text-align: right; color:#088A08;" >{{ producto.valor }}</td>
                            </tr>
                        {% endifequal %}                    
                    {% endfor %}
                </tbody>
                <tfoot>
                    <tr align="center">
                        <td>Valor Total Inventario</td>
                        <td></td>
                        <td style="text-align: right;">{{ valor }}</td>
                    </tr>
                </tfoot>
            </table>
        {% else %}
            <p><b>No tiene actualmente productos en su inventario</b></p>
        {% endif %}
{% endblock %}

{% block content-colum2 %}
    {% if user.is_authenticated %}
        <ul>
            <li><a href="{% url index %}">{% trans "Home" %}</a></li>
            <li><a href="{% url inventario %}">Inventario</a></li>
            <li><a href="{% url ver_historial_inventario %}">Historial Inventario</a></li>
            <li><a href="{% url agregar_productos_inventario %}">Agregar Productos Inventario</a></li> 
        </ul>
    {% endif %}   
{% endblock %}